#include <stdio.h>

int addDigits(int num)
{
    int count = 0;
    while(num != 0)
    {
        count += num % 10;
        num /= 10;
        if(num == 0 && count > 10)
        {
            num = count;
            count = 0;
        }
    }
    return count;

}

int main()
{
    int num = 56;
    int n = addDigits(num);
    printf("%d\n",n);
    return 0;
}